package com.tsd;

import com.tsd.core.constants.Constants;
import com.tsd.system.entity.SysAccountSetExt;

/**
 * common模块的信息常量，目的是减少魔法值，减少内存分配
 *
 * @author Hillpool
 */
public class CommonMsgNameConstants {
    public static final String MAX_USER_QTY = "用户数已达最大值，无法新增！";
    public static final String DATA_TYPE_NOT_ARRAY = "数据类型不正确，非数组类型";
    public static final String NOT_SUPPORT_OPERATION = "不支持该操作";
    public static final String NO_DATA = "数据不存在";
    public static final String MASTER_USER_NO_DELETE = "主账号不能被删除";

    public static final String ERROR_MSG_PARAM = "参数：";
    public static final String ERROR_MSG_PASSWORD = "密码不正确！";
    public static final String ERROR_MSG_ACCOUNT_RESETING = "账套正在重置中，不能执行此处理！";
    public static final String ERROR_MSG_ACCOUNT_EXPIRED = "账套已过期";
    public static final String ERROR_MSG_ACCOUNT_NOT_AVAILABLE = "账套不可用，请联系客服！";
    public static final String ERROR_MSG_ACCOUNT_CONNECT = "访问账套失败：";
    public static final String ERROR_MSG_ACCOUNT_NOT_OPENED = "该账套未开通此功能";
    public static final String ERROR_MSG_NO_PERMISSION = "无权操作此功能";
    public static final String ERROR_MSG_LIST_EYPE = "数据类型不正确，非数组类型";
    public static final String ERROR_MSG_CONTENT_TYPE_NOT_JSON = "content-Type 必须是application/json";
    public static final String ERROR_MSG_DATABASE = "数据库错误：";
    public static final String ERROR_MSG_DATABASE_CONNECT = "数据链接抖动，请尝试刷新";
    public static final String ERROR_MSG_PDF_FILE = "Pdf文件不正确，请检查文件是否正常";
    public static final String ERROR_MSG_SESSION_EXPIRED = "当前会话失效，请尝试刷新";
    public static final String ERROR_MSG_REQ_METHOD_NOT_SUPPORT = "请求方法不支持：";
    public static final String ERROR_MSG_UNDEFINED = "未定义：";
    public static final String ERROR_MSG_RECORD_NOT_EXISTS = "该记录不存在";

    public static final String EMPTY_MSG = "空数据";
    public static final String EMPTY_MSG_TIP = "请提供参数：";
    public static final String EMPTY_MSG_TIP2 = "不能为空！";
    public static final String EMPTY_MSG_SID = "请提供参数：sid";
    public static final String EMPTY_MSG_SIDS = "请提供参数：sids";
    public static final String EMPTY_MSG_URL = "请提供参数：url";
    public static final String EMPTY_MSG_PARAM = "请提供参数：param";
    public static final String EMPTY_MSG_FILE_PATH = "请提供参数：filePath";
    public static final String EMPTY_MSG_COLUMN_FIELD = "请提供参数：columnField";
    public static final String EMPTY_MSG_ACCOUNT = "账套不存在";
    public static final String EMPTY_MSG_DRIVER = "请提供参数：driver";
    public static final String EMPTY_MSG_DB_URL = "请提供参数：db_url";
    public static final String EMPTY_MSG_DB_USER_NAME = "请提供参数：db_user_name";
    public static final String EMPTY_MSG_DB_USER_PASSWORD = "请提供参数：db_user_password";
    public static final String EMPTY_MSG_PASSWORD = "请提供参数：password";
    public static final String EMPTY_MSG_CODE = "请提供参数：code";

    public static String getAccountStateError(SysAccountSetExt as) {
        return (as == null ? EMPTY_MSG_ACCOUNT : (as.getState() == Constants.STATE_EXPIRED ? ERROR_MSG_ACCOUNT_EXPIRED : ERROR_MSG_ACCOUNT_NOT_AVAILABLE));
    }

    public static String getEmptyMsg(String field) {
        return EMPTY_MSG_TIP + field;
    }

    public static String getEmptyMsg2(String field) {
        return ERROR_MSG_PARAM + field + EMPTY_MSG_TIP2;
    }

    public static String getErrorMsgList(String field) {
        return ERROR_MSG_PARAM + field + ERROR_MSG_LIST_EYPE;
    }

}
